#ifndef FESCREENUPDATER_PRIVATE_H
#define FESCREENUPDATER_PRIVATE_H
#include "fecore_global.h"
#include "feactualdataconsumer.h"
#include <QObject>
#include <QMap>
#include <QList>
#include <QByteArray>

class FeActualDataService;

class FeScreenUpdaterTarget
{
public:
	FeScreenUpdaterTarget();
	FeScreenUpdaterTarget(QWidget *, const QString &property);
	FeScreenUpdaterTarget(const FeScreenUpdaterTarget &);
	~FeScreenUpdaterTarget();

	QWidget *widget() const {return w;}
	const char *property() const {return prop.constData();}

	FeScreenUpdaterTarget &operator=(const FeScreenUpdaterTarget &);

private:
	QWidget *w;
	QByteArray prop;
};

class FeScreenUpdater: public QObject, public FeActualDataConsumer
{
	Q_OBJECT
public:
	FeScreenUpdater(FeActualDataService *s, QObject *parent=0);
	virtual ~FeScreenUpdater();

	void addBind(FeActualDataId id, QWidget *widget, const QString &property);

	virtual void dataChanged(FeActualDataId id, const QVariant &value);

public slots:
	void start();
	void stop();

private:
	typedef QMap<FeActualDataId, QList<FeScreenUpdaterTarget> > Binding;

	FeActualDataService *s;
	bool run;
	Binding binding;
};

#endif